﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
namespace YZZ
{
    static class ApplicationParameters
    {
        public static bool SkipOldCodes = true;
    }
    class Config
    {
        private static Dictionary<string, string> Configuration;
        private static bool inited = false;
        private static string ConnectionString { get; set; }
        public static string Get(string key)
        {
            if(!inited)init();
            string result=string.Empty;
            Configuration.TryGetValue(key, out result);
            return result;
        }
        private static void init()
        {

            Configuration = new Dictionary<string, string>();
            //ConnectionString = "Data Source=39.101.160.234,1455;Initial Catalog=YTA5ULT_01;User ID=sa;PWD=KBtLiXWtnHvJri803854";
            //ConnectionString = "Data Source=";
            //ConnectionString += ConfigurationManager.AppSettings["DataServer"];
            //if (ConfigurationManager.AppSettings["Port"] != "1433" && !string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["Port"]))
            //    ConnectionString += "," + ConfigurationManager.AppSettings["Port"];
            //ConnectionString += ";Initial Catalog=";
            //ConnectionString += ConfigurationManager.AppSettings["YTDataBase"];
            //ConnectionString += ";User ID=sa;PWD=";
            //ConnectionString += ConfigurationManager.AppSettings["sa"];

            //string DhbConnectionString = string.Empty;
            //DhbConnectionString = "Data Source=";
            //DhbConnectionString += ConfigurationManager.AppSettings["DataServer"];
            //if (ConfigurationManager.AppSettings["Port"] != "1433" && !string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["Port"]))
            //    DhbConnectionString += "," + ConfigurationManager.AppSettings["Port"];
            //DhbConnectionString += ";Initial Catalog=";
            //DhbConnectionString += ConfigurationManager.AppSettings["DhbDataBase"];
            //DhbConnectionString += ";User ID=sa;PWD=";
            //DhbConnectionString += ConfigurationManager.AppSettings["sa"];

            //Configuration.Add("DefaultConnection", ConnectionString);
            //Configuration.Add("DhbConnection", DhbConnectionString);
            //Configuration.Add("AllowImportFromDhbDatabase", "0");
            //Configuration.Add("GetAccessTokenUrl", ConfigurationManager.AppSettings["GetAccessTokenUrl"]);
            //Configuration.Add("GetBaseURL", ConfigurationManager.AppSettings["GetBaseURL"]);
            //Configuration.Add("Debuging", "0");
            //Configuration.Add("SerialNumber", ConfigurationManager.AppSettings["SerialNumber"]);
            //Configuration.Add("Word", ConfigurationManager.AppSettings["Word"]);
            Configuration.Add("EnableLog", ConfigurationManager.AppSettings["EnableLog"]);
            Configuration.Add("LogFile", ConfigurationManager.AppSettings["LogFile"]);
            inited = true;
         }
    }
}
